var circle = function() {}

circle.prototype.begin = function(lastx, lasty) {
	this.life = 1;
	this.lastx = lastx;
	this.lasty = lasty;

	this.strokeStyle;
	this.radius1 = 0;
	this.radius2 = -12;

	this.alpha1 = 0.7;
	this.alpha2 = 0.6;
}

circle.prototype.draw = function() {
	var lifeTimeout = 0.01;
	var alphaTimeout = 0.02;

	ctx.save();
	drawWaveCircle(this.lastx, this.lasty, this.radius1, this.alpha1);
	this.alpha1 -= alphaTimeout;
	this.alpha1 = this.alpha1.toFixed(2);
	//first circle
	if (this.radius2 >= 0) {
		drawWaveCircle(this.lastx, this.lasty, this.radius2, this.alpha2);
		this.alpha2 -= alphaTimeout;
		this.alpha2 = this.alpha2.toFixed(2);
	} 
	//second circle
	this.life -= lifeTimeout;
	this.life = this.life.toFixed(2);

	this.radius1 += 0.5;
	this.radius2 += 0.5;

	ctx.restore(); //恢复stack
}

function drawWaveCircle(lastx, lasty, radius, alpha) {
	ctx.shadowBlur = 10;
	ctx.shadowColor = "#ffffff";
	ctx.lineWidth = 2;//wave的属性

	ctx.strokeStyle = "rgba(229,221,229," + alpha + ")";
	ctx.beginPath();
	ctx.arc(lastx, lasty, radius, 0, Math.PI * 2, true);
	ctx.stroke();
}